//批量删除

function delProtcolDesigns() {
	isOnline('operator');
	if(confirm("确认删除所选协议吗？")) {
		var ids = ""; //待删除的安全协议id数组
		$.each($("#protocolDesignList input[type='checkbox']:checked"), function() {
			if(ids == "") {
				ids = ids + $(this).val();
			} else {
				ids = ids + "," + $(this).val();
			}
		});
		console.log(ids);

		$.ajax({
			url: HOST.concat("/delprotocoldesigns?token=") + config.token,
			type: "POST",
			contentType: "application/x-www-form-urlencoded",
			data: {
				"idList": ids
			},
			dataType: "json",
			success: function(res) {
				checkLogin(res);
				if(res.meta.state==="success"){
					alert("删除成功");
				}else{
					alert("删除失败");
				}
				window.location.href = "designProtocol.html";
			}
		});

	}

}

function  createProtocol() {

	isOnline('operator');//判断用户是否处于在线状态

	/*$('#dlg-choose').dialog('open');*/

	var w=window.screen.width;
	var h=window.screen.height;

	console.log("w: "+w);
	console.log("h: "+h);


	if(h>1030){
		h=h/4;
	}else{
		h=h/5;
	}

	if(w>1600){
		w=w/3;
	}else{
		w=w/4;
	}
	$('#dlg-choose').dialog({
		//title: 'My Dialog',
		top: h,
		left:w,
		closed: false,
		//cache: false,
		//href: 'get_content.php',
		modal: true
	});

}